package com.semanticweb.webapp.model.ontology;

import org.apache.lucene.document.Document;

import com.semanticweb.webapp.ontology.CType;
import com.semanticweb.webapp.ontology.OntHelper;
import com.semanticweb.webapp.search.IDocument;

/**
 * Class which represents 'Cena' from the chart.
 * 
 * @author Lab
 * 
 */
public class Price extends DefaultAbstractEntity<Double> implements IDocument {

    private String priceUnit;

    public Price(final String id) {
        super(id);
    }

    @Override
    public void toRDF() {
        OntHelper.toRDFDimension(this.id, this.value, this.priceUnit, CType.PRICE);

    }

    public void fromRDF() {
        this.value = OntHelper.fromRDFDimensionValue(this.id, CType.PRICE);
        this.priceUnit = OntHelper.fromRDFDimensionUnit(this.id, CType.PRICE);
    }

    public String getPriceUnit() {
        return this.priceUnit;
    }

    public void setPriceUnit(final String priceUnit) {
        this.priceUnit = priceUnit;
    }

    @Override
    public void toIndexDocument(final Document doc) {
        // Nothing to index
    }

}
